package lab02.test34;

import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;

public class Test {
    public static void main(String[] args) {
        List<String> list=new ArrayList<>();
        String[] s=new String[4];
        list.add(s[0]="apple");
        list.add(s[1]="grape");
        list.add(s[2]="banana");
        list.add(s[3]="pear");
        Collections.sort(list, Collator.getInstance(Locale.CHINA));
        for(int i=0;i<list.size();i++){
            System.out.println(list.get(i));
                }
                String a=s[0],b=s[0];
        for (int j=1;j<4;j++){
            if (a.length()<s[j].length()){
                a=s[j];
            }
            else {
                b=s[j];
            }
        }
        System.out.println("最大元素："+a+"  "+"最小元素："+b);
            }
        }
